#pragma once
#include <game/Config.h>
#include <map>
#include <memory>
#include <string>

#include <boost/function.hpp>

ARELLO_GAME_NAMESPACE_DECL_START
namespace flow {

class Trigger;
typedef boost::function<std::auto_ptr<Trigger> ()> TriggerCreator;

class TriggerFactory
{
public:
	TriggerFactory();
	TriggerFactory(const TriggerFactory& rhs);
	~TriggerFactory();
	const TriggerFactory& operator=(const TriggerFactory& rhs);

	void Register(const std::string& name, TriggerCreator creator);
	std::auto_ptr<Trigger> Create(const std::string& name) const;
private:
	std::map<std::string, TriggerCreator> triggers;
};

} // namespace flow
ARELLO_GAME_NAMESPACE_DECL_END